#include "stdafx.h"
#include "VODAS.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

typedef BOOL ( * InstallHook		)( VOID );
typedef BOOL ( * UnInstallHook		)( VOID );
typedef VOID ( * UnTrayAll			)( VOID );
typedef UINT ( * GetTrayMessageID	)( VOID );

UINT g_TrayMessageID = 0;

BEGIN_MESSAGE_MAP(CVODASApp, CWinApp)
	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()

CVODASApp::CVODASApp( VOID ) :
	m_pVODASDlg(	NULL ),
	m_hModule(		NULL )
{
}

CVODASApp theApp;

BOOL CVODASApp::InitInstance( VOID )
{
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize	= sizeof( InitCtrls );
	InitCtrls.dwICC		= ICC_WIN95_CLASSES;
	InitCommonControlsEx( &InitCtrls );
	
	CWinApp::InitInstance();

	AfxEnableControlContainer();

	SetRegistryKey( _T( " V O D A S " ) );

	this->m_pVODASDlg = new CVODASDlg();
	if( !this->m_pVODASDlg )
		return FALSE;

	if( !CEventHookerWraper::GetInstance().Initialize() )
		return FALSE;
	
	this->m_pVODASDlg->Create( IDD_VODAS_DIALOG, NULL );
	this->m_pMainWnd = this->m_pVODASDlg;
	::ShowWindow( m_pMainWnd->GetSafeHwnd(), SW_HIDE );

	return TRUE;
}

INT CVODASApp::ExitInstance( VOID )
{
	if( this->m_pVODASDlg )
	{
		this->m_pVODASDlg->DestroyWindow();
		delete this->m_pVODASDlg;
		this->m_pVODASDlg = NULL;
	}

	CEventHookerWraper::GetInstance().CleanUp();

	return CWinApp::ExitInstance();
}
